﻿using UnityEngine;
using System;
using System.Collections;

/// <summary>
/// Use unicode character indexes for the enum. The advantage is that the keys can actually be used to display the key in debug-messages 
/// by using an easy-to-read charsign like →
/// </summary>
public enum InputKey
{
    None = 'N',
    Right = '→',
    Left = '←',
    Crouch = '↓',
    Jump = 'J',
    AttackA = 'A',
    AttackB = 'B',
}

public class InputManager
{
    public static InputKey GetKeyDown()
    {
        if (Input.GetButtonDown("Jump")) return InputKey.Jump;
        else if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") > 0f) return InputKey.Right;
        else if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") < 0f) return InputKey.Left;
        else if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") > 0f) return InputKey.Jump;
        else if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") < 0f) return InputKey.Crouch;
        else return InputKey.None;
    }
}